#include <iostream>
#include <functional>
#include <thread>
#include <future>
#include <unistd.h>

void print_int(std::future<int>& fut) {
    int x = fut.get();
    std::cout << "value: " << x << '\n';
}

int main() {
    std::promise<int> prom;
    std::future<int> fut = prom.get_future();

    std::thread th1(print_int, std::ref(fut));

    sleep(5);
    prom.set_value(11);

    th1.join();
    return 0;
}
